<?php
header("Content-type: text/html;charset=utf-8");
include('include/common.php'); 

?>
<!DOCTYPE html>
<!-- saved from url=(0051)http://localhost/douphp/m/product_category.php?id=1 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="viewport" content="width=device-width,user-scalable=0,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="apple-touch-icon-precomposed" href="http://localhost/douphp/m/data/logo-icon.png">
<title></title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="generator" content="DouPHP v1.3">
<link href="images/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="images/jquery.min.js"></script>
<script type="text/javascript" src="images/global.js"></script>
</head>
<body>
<div id="wrapper">
 <div id="header">
  <a href="index.php" class="home"></a>
   <div class="topSearch"><div class="searchBox">
 <form name="search" method="get" action="productabc.php">
  <input name="search" type="text" class="keyword" autocomplete="off" maxlength="128" value="产品搜索" onClick="formClick(this,&#39;产品搜索&#39;)">
  <input type="submit" class="btnSearch" value="提交">
 </form>
</div></div>
  <a href="http://localhost/douphp/m/catalog.php" class="siteMap"></a></div>
 <div class="urHere">当前位置：<a href="http://localhost/douphp/m/product_category.php">产品中心</a><b>&gt;</b>
 </div> 
 <div class="treeBox">
  <a href="">电子数码</a>
  <a href="">家居百货</a>
 </div>
 <div id="productCat">
  <div class="productList">
  
  
  <?php
$result = mysql_query("SELECT * FROM ljcms_product");
  while($r = @mysql_fetch_array($result))
	{
  ?>
   <dl>
    <dd>
    <p class="img"><a href="product.php?id=<?=$r["productid"]?>"><img src="../<?php echo $r['uploadfiles']; ?>" width="135" height="135"></a></p>
    <p class="name"><a href="<?php echo $r['metadescription']; ?>"><?php echo $r['productname'];?></a></p>
    <p class="price">￥<?php echo $r['nprice'];?> 元</p>
    </dd>
   </dl>
    <?php
     }
   ?>
     </div>
	 
	 
	 
	 
	 
  <div class="pager"><em>上一页</em><span>第1/1页</span><em>下一页</em>
  
  
  
  
  
  <?php 
$link=MySQL_connect('localhost','root','root'); 
mysql_select_db('phpcmsa'); 
mysql_query('set names utf8'); 
$Page_size=10; 
$result5=mysql_query('select * from ljcms_product'); 
$count = mysql_num_rows($result5); 
$page_count = ceil($count/$Page_size); 

$init=1; 
$page_len=7; 
$max_p=$page_count; 
$pages=$page_count; 

//判断当前页码 
if(empty($_GET['page'])||$_GET['page']<0){ 
$page=1; 
}else { 
$page=$_GET['page']; 
} 

$offset=$Page_size*($page-1); 
$sql="select * from ljcms_product limit $offset,$Page_size"; 
$result6=mysql_query($sql,$link); 
while ($row=mysql_fetch_array($result6)) { 
?> 
<?php 
} 
$page_len = ($page_len%2)?$page_len:$pagelen+1;//页码个数 
$pageoffset = ($page_len-1)/2;//页码个数左右偏移量 

$key='<div class="page">'; 
$key.="<span>$page/$pages</span> "; //第几页,共几页 
if($page!=1){ 
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page=1\">第一页</a> "; //第一页 
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page=".($page-1)."\">上一页</a>"; //上一页 
}else { 
$key.="第一页 ";//第一页 
$key.="上一页"; //上一页 
} 
if($pages>$page_len){ 
//如果当前页小于等于左偏移 
if($page<=$pageoffset){ 
$init=1; 
$max_p = $page_len; 
}else{//如果当前页大于左偏移 
//如果当前页码右偏移超出最大分页数 
if($page+$pageoffset>=$pages+1){ 
$init = $pages-$page_len+1; 
}else{ 
//左右偏移都存在时的计算 
$init = $page-$pageoffset; 
$max_p = $page+$pageoffset; 
} 
} 
} 
for($i=$init;$i<=$max_p;$i++){ 
if($i==$page){ 
$key.=' <span>'.$i.'</span>'; 
} else { 
$key.=" <a href=\"".$_SERVER['PHP_SELF']."?page=".$i."\">".$i."</a>"; 
} 
} 
if($page!=$pages){ 
$key.=" <a href=\"".$_SERVER['PHP_SELF']."?page=".($page+1)."\">下一页</a> ";//下一页 
$key.="<a href=\"".$_SERVER['PHP_SELF']."?page={$pages}\">最后一页</a>"; //最后一页 
}else { 
$key.="下一页 ";//下一页 
$key.="最后一页"; //最后一页 
} 
$key.='</div>'; 
?>  
  
  
  
  
  
  
  </div> </div>
 <div id="footer">
 <a href="javascript:;" onFocus="this.blur();" class="goTop">返回顶部</a>
 <ul>
  <li class="footNav"><a href="http://localhost/mobile">手机版</a><a href="http://localhost/">电脑版</a></li>
  <li class="copyRight">企业网站管理系统 2015 All Rights Reserved.</li>
  <li class="powered"><a href="  " target="_blank">企业网站管理系统</a> </li>
 </ul>
</div>
 </div>

</body>
</html>
<?php
  mysql_close($link);
?>
